using UnityEngine;

public class FriendsUIMessageManager : MonoBehaviour
{
	public static FriendsUIMessageManager instance;

	public GameObject noFriendsMessagePanel;

	public GameObject noInvitesMessagePanel;

	public GameObject noChatsMessagePanel;

	public GameObject removePlayerMessagePanel;

	public GameObject cantJoinMessagePanel;

	public UILabel cantJoinLabel;

	public FriendsUISearchNotification searchMessagePanel;

	private void Awake()
	{
		if (instance != null)
		{
			Object.DestroyImmediate(base.gameObject);
			return;
		}
		instance = this;
		Object.DontDestroyOnLoad(base.gameObject);
	}

	public void HideAll()
	{
		noFriendsMessagePanel.SetActive(false);
		noInvitesMessagePanel.SetActive(false);
		noChatsMessagePanel.SetActive(false);
		searchMessagePanel.gameObject.SetActive(false);
		cantJoinMessagePanel.SetActive(false);
		removePlayerMessagePanel.SetActive(false);
	}

	public void OnFriendsTabOpen(int friendsCount)
	{
		if (!cantJoinMessagePanel.activeSelf || friendsCount == 0)
		{
			HideAll();
			noFriendsMessagePanel.SetActive(friendsCount == 0);
		}
	}

	public void OnInvitesTabOpen(int invitesCount)
	{
		HideAll();
		noInvitesMessagePanel.SetActive(invitesCount == 0);
	}

	public void OnChatsTabOpen(int friendsCount)
	{
		HideAll();
		noChatsMessagePanel.SetActive(friendsCount == 0);
	}

	public void OnSearchTabOpen(int playersFound)
	{
		HideAll();
		if (playersFound == 0)
		{
			searchMessagePanel.ShowHint();
		}
	}

	public void OnRemovePlayer()
	{
		HideAll();
		removePlayerMessagePanel.SetActive(true);
	}

	public void OnCantJoin(string reason)
	{
		HideAll();
		cantJoinMessagePanel.SetActive(true);
		cantJoinLabel.text = reason;
	}
}
